const ASYNC_ROUTE_RE = /'async(@.*)'/g;

module.exports = function(source) {
  const replaced = source.replace(ASYNC_ROUTE_RE, (rep, route) => {
    return `Loadable({ loader: () => import('${route}'), loading: Loading })`;
  });

  return replaced;
};
